<template>
  <el-dialog title="详细数据" :visible.sync="dialogVisible" width="800">
    <div class="box">
      <el-table :data="unitList">
        <el-table-column
          label="单位名称"
          align="left"
          prop="unit_name"
          width="300"
        >
          <template slot-scope="scope">
            <div @click="handleClick(scope.row)" class="change-cursor">
              {{ scope.row.unit_name }}
            </div>
          </template>
        </el-table-column>

        <el-table-column label="扣分项数量" align="left" prop="num" />
        <el-table-column
          label="法定代表人"
          align="left"
          prop="unit_representative"
        />
        <el-table-column label="单位状态" align="left" prop="unit_statues">
          <template slot-scope="scope">
            <div>
              {{
                scope.row.unit_statues == 0
                  ? "正常"
                  : scope.row.unit_statues == 1
                  ? "排除"
                  : scope.row.unit_statues == 2
                  ? "扣分过多排除"
                  : "已有项目进行中排除"
              }}
            </div>
          </template>
        </el-table-column>
        <!-- <el-table-column
          label="注册地址"
          align="left"
          prop="unit_address"
          width="320"
        /> -->
        <el-table-column label="备注" align="left" prop="unit_remarks" />
      </el-table>
    </div>
  </el-dialog>
</template>

<script>
import {
  getQualified,
  getQualiunitType,
  getQualiunitscoreList,
} from "@/api/unit/random";

export default {
  props: {
    title: {
      type: String,
    },
    unitList: {
      type: Array,
    },
    dialogTableVisible: {
      type: Boolean,
    },
  },
  data() {
    return {
      vis: true,
    };
  },
  methods: {
    handleClick(row) {
      this.$emit("openDetail", row.unit_id);
    },
  },
  computed: {
    dialogVisible: {
      get() {
        return this.dialogTableVisible;
      },
      set(val) {
        this.$emit("update:dialogTableVisible", val);
      },
    },
  },
};
</script>

<style scoped>
.change-cursor {
  height: 100%;
  cursor: pointer;
}

::v-deep .el-table .cell {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
::v-deep .el-table .cell:hover {
  white-space: normal;
}
.box {
  height: 700px;
  overflow: auto;
}
</style>